package com.rightsidetech.mall.service;

import com.github.pagehelper.PageInfo;
import com.rightsidetech.commom.base.DelReq;
import com.rightsidetech.commom.base.ResponseData;
import com.rightsidetech.commom.service.IService;
import com.rightsidetech.mall.dto.request.*;
import com.rightsidetech.mall.dto.response.*;
import com.rightsidetech.mall.entity.MallAgentCommodity;
import com.rightsidetech.mall.entity.MallCommoditySpecs;
import com.rightsidetech.mall.entity.MallCommodityWithBLOBs;

import java.util.List;

public interface MallCommodityService extends IService<List<MallAgentCommodityResp>,List<Long>> {

    ResponseData saveCommodity(CommoditySaveReq req,String createrName,Long createrId);

    ResponseData<CommodityDetailResp> findDetailById(Long id);

    ResponseData<PageInfo<CommodityPageResp>> selectPageList(CommodityPageReq req);

    ResponseData updateCommodity(CommodityUpReq req,String updaterName,Long updaterId);

    ResponseData verifyCommodity(VerifyCommodityReq req,String createrName,Long createrId);

    CommodityOrderDetailResp findOrderDetailByCommodityId(Long commodityId);

    MallCommodityWithBLOBs selectByPrimaryKey(Long commodityId);

    ResponseData<PageInfo<CommodityAgentResp>> agentPage(AgentPageReq req, Long agentId);

    ResponseData sort(CommoditySortReq req);

    ResponseData agentSort(CommodityAgentSortReq req,Long agentInfoId);

    ResponseData arraignment(DelReq req);

    ResponseData popularCommodity(CommodityPopularReq req);

    ResponseData AgentLackStock(AgentLackStockReq req,Long agentInfoId);

    ResponseData isGrounding(CommodityIsGroundingReq req);

    ResponseData deleteAgentByCommodity(Long commodityId);

    ResponseData platformCommodity(MallCommodityWithBLOBs commodity, List<Long> agentIds);

    /**
     *  根据商品id查询商品是否上架
     * @param commodityId 商品id
     * @return true上架 false下架
     */
    boolean isUpShelf(Long commodityId);

    /**
     * 根据商品id和条码查询规格商品
     * @param commodityId
     * @param barCode
     * @return
     */
    MallCommoditySpecs selectSpecsByCommodityAndBarCode(Long commodityId,String barCode);


    MallCommoditySpecs selectSpecsByCommodityAndSpece(Long commodityId,String spece);

    /**
     * 根据代理商id和商品id判断代理商商品是否缺货
     * @param agentId 代理商id
     * @param commodityId 商品id
     * @return false缺货 true正常
     */
    boolean isLackStock(Long agentId,Long commodityId);

    List<MallAgentCommodity> findAgentCommomdityList(Long commodityId);

    String selectImg(Long commodityId);

    ResponseData<List<CommoditySearchResp>> searchCommodity(String commodityName);

    ResponseData<List<CommoditySpescResp>> specsIntegral(DelReq req);

    MallCommoditySpecs selectSpecsByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(MallCommodityWithBLOBs record);

    ResponseData<List<CommoditySearchResp>> noIntegral(String commodityName);

    /**
     * @param agentId 代理商id
     * @param commodityId 商品id
     * @return true可以在此代理商购买
     */
    boolean checkCommodityByAgentId(Long agentId,Long commodityId);

    ResponseData<List<CommodityInfoResp>> selectMallInfo(Long id,Long agentId);

    CommodityImportResp selectCommodityByCommodityName(String commodityName);

    ResponseData<List<CommodityPageResp>> selectList(CommodityPageReq req);

    ResponseData<List<CommodityAgentResp>> agentList(AgentPageReq req,Long agentInfoId);

    ResponseData<List<CommodityPageResp>> selectActivityPageList(CommodityActivityPageReq req);
}
